<div class="section">
        <?php
        $this->widget('AdminManCompMenu', array(
            'comp_id' => $model->id,
            'comp_title' => $model->title,
        ));
        ?>
		<div class="box">
			<div class="title">
				<h2><?=(isset($order['id']) && $order['id'])?Yii::t('app','Редактирование заявки'):Yii::t('app','Добавление заявки')?></h2>
				<span class="hide"></span>
			</div>
<div class="content forms">
<?php $form=$this->beginWidget('CActiveForm', array(
                            'id'=>'orders-form',
                            'enableAjaxValidation'=>false,
                            'action'=>'',
                            'method'=>'post',
                    )); ?>
    <?=$form->errorSummary($order); ?>
    
    <!----------------------------- Фонды---------------->
    <?php if($funds) {?>
        <div class="name_param"><?=Yii::t('app', 'Существующие фонды')?>:</div>
        <div style="border:1px solid grey;">
          <?php foreach($funds as $k=>$fund) {?>
                <table><tr><td>
                    <input type="radio" name="funds" value="<?=$fund->id?>" <?=($k=='0')?'checked':''?>>
                </td><td>
                    <?=$fund->title?>
                </td><td>
                    <?=$fund->descriptions?>
                </td></tr></table>
         <?php } ?>   
        </div>
    <?php } ?>
    <!--------------------------------------------------->
    <table>
        <tr>
            <td>
            <div class="line1" style="clear:both;">
                <div class="list_adjustment">     
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Фамилия')?>:</div>
                        <?=CHtml::activeTextField($order,'user_surname',array('class'=>'medium')); ?>
                        <?php  echo $form->error($order,'user_surname'); ?>
                    </div> 
                    <div style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Мобильный телефон')?>:</div>
                        <?=CHtml::activeTextField($order,'user_phone',array('class'=>'medium')); ?>
                        <?php  echo $form->error($order,'user_phone'); ?>
                    </div>
                </div>
             </td>
         </tr>
         <tr>
             <td>
                <div class="line1" style="clear:both;">
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Имя')?>:</div>
                        <?=CHtml::activeTextField($order,'user_name',array('class'=>'medium')); ?>
                        <?php  echo $form->error($order,'user_name'); ?>
                    </div> 
                    <div style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'E-mail')?>:</div>
                        <?=CHtml::activeTextField($order,'user_email',array('class'=>'medium')); ?>
                        <?php  echo $form->error($order,'user_email'); ?>
                    </div>
                </div>
             </td>
         </tr>
         <tr>
             <td>
                <div class="line1" style="clear:both;">
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Отчество')?>:</div>
                        <?=CHtml::activeTextField($order,'user_middlename',array('class'=>'medium')); ?>
                        <?php  echo $form->error($order,'user_middlename'); ?>
                    </div> 
                    <div style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Регион')?>:</div>                           
                        <select name="Orders[user_region_id]" id='region' class='jcalendar-select-val'>
                            <?php if($order['user_region_id']) { ?><option value="<?=$order['user_region_id']?>"><?=$regions_array[$order['user_region_id']]?></option><?php } ?>
                            <?php foreach($regions_array as $k=>$v) { ?>
                                    <option value="<?=$k?>"><?=$v?></option>
                            <?php } ?>
                        </select>
                        <?php echo $form->error($order,'user_region_id'); ?>
                    </div>
                </div>
             </td>
         </tr>
         <tr>
             <td>
                 <div class="line1" style="clear:both;">
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Сообщение')?>:</div>
                        <?=CHtml::activeTextArea($order,'user_message',array('class'=>'medium')); ?>
                                                <?php  echo $form->error($order,'user_message'); ?>
                     </div> 
                    <div style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                    <div style="float:left;">
                        <div class="name_param"><?=Yii::t('app', 'Статус')?>:</div> 
                        <?php $status_array = array('Принята','Не выкуплена','Выкуплена','Отклонена'); ?>
                        <select name="Orders[status]" id='region' class='jcalendar-select-val'>
                            <option value="<?=(isset($status_array[$order['status']])?$order['status']:'')?>"><?=(isset($status_array[$order['status']])?$status_array[$order['status']]:'Выберите статус')?></option>
                            <?php foreach($status_array as $k=>$v) { 
                                    if(isset($order['status']) && $k!=$order['status']) {?>
                                        <option value="<?=$k?>"><?=$v?></option>
                                    <?php } 
                                    if(!isset($order['status'])) {?>
                                        <option value="<?=$k?>"><?=$v?></option>
                            <?php }} ?>
                        </select>
                        <?php echo $form->error($order,'user_region_id'); ?>
                    </div>

                 </div>
             </td>
         </tr>    
    </table>
    <!---------------------------------------------->
        <div class="line button">
            <button type="submit" class="green medium"><span><?=(($order->id)?'Сохранить':'Добавить')?></span></button>
            <button type="submit" onclick="window.location.replace('<?=$this->createUrl("/mancompanies/orders/id/$model->id")?>');return false; " class="blue medium"><span>Отмена</span></button>
        </div>

    </div>

    <?$this->endWidget(); ?>

			</div>
		</div>